package com.example.metadatatest.CustomizeExecutor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * CustomizeListener
 *
 * 遍历所有监听器  执行event有关监听器的方法
 *
 * @blame 吴经纶
 */
@Component
@Slf4j


public class CustomizeListener implements ApplicationListener<CustomizeEvent> {

    @Override
    public void onApplicationEvent(CustomizeEvent event) {
        log.info("事件监听器收取Event 休眠当前线程2秒");
        try{
            Thread.sleep(2000);
        }catch (Exception e)
        {
            e.printStackTrace();
        }
        log.info("事件监听器获取到的信息是{}",event.getMessage());
    }
}
